package com.sby.Controller;

import com.sby.Controller.entity.realData;
import com.sby.dao.InformationPageDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

@Controller
public class indexController {
    @Autowired
    private InformationPageDao informationPageDao;
    @RequestMapping("/")
    public String toIndex(HttpServletRequest request) throws IOException {
        request.setAttribute("InfoList",informationPageDao.findAll());
        return "index";
    }
    @RequestMapping("/data")
    @ResponseBody
    public List<realData> findData(){
        List<realData> list = informationPageDao.findRealData();
        return list;
    }

}
